FINERACT-405: Standardize mobile number validation across Client and Staff#5964
Open
anubhavio wants to merge 1 commit into
Open
FINERACT-405: Standardize mobile number validation across Client and Staff#5964anubhavio wants to merge 1 commit into
anubhavio wants to merge 1 commit into
Conversation
abdd8a2 to
3614282
Compare
IOhacker
requested changes
Jun 9, 2026
|
|
||
| public class PhoneNumberConstants { | ||
|
|
||
| public static final String MOBILE_NUMBER_REGEX = |
Contributor
There was a problem hiding this comment.
This should be configurable in a property, not fixed.
Contributor
Author
There was a problem hiding this comment.
@IOhacker Thanks for the feedback. I investigated the existing validation and configuration patterns in Fineract. To make the regex configurable, I plan to move it into FineractProperties and replace the Staff @pattern validation with a custom validator backed by a shared PhoneNumberValidationService, so both Client and Staff validations use the same configurable rule.
Contributor
There was a problem hiding this comment.
@anubhavio that is the best approach to use the same configurable rule.
Move phone number validation from a hardcoded regex constant to a configurable property in FineractProperties. Introduce a shared PhoneNumberValidationService and custom @ValidPhoneNumber constraint so both client and staff validations use the same configurable rule. FINERACT-405: Centralize mobile number validation regex FINERACT-405: Add missing ASF license header WIP: save phone validation changes
3614282 to
be97cdc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR replaces the hardcoded mobile number validation regex with a configurable property-based validation approach.
Changes
-Added phone validation configuration under FineractProperties
-Introduced PhoneNumberValidationService to provide a shared validation rule
-Added custom @ValidPhoneNumber constraint and PhoneNumberValidator
-Updated StaffCreateRequest and StaffUpdateRequest to use the new validator
-Updated ClientDataValidator to use the same configurable validation rule
-Removed the hardcoded phone number regex constant
-Added/updated tests for client mobile number validation